<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<aside class="main-sidebar">
    <!-- sidebar: style can be found in sidebar.less -->
    <section class="sidebar">
        <!-- Sidebar user panel -->
        <div class="user-panel">
            <div class="pull-left image">
                <img src="${pageContext.request.contextPath}/img/user2-160x160.jpg"
                     class="img-circle" alt="User Image">
            </div>
            <div class="pull-left info">
                <p>
                    <%-- name 属性为形参--%>
                    <input type="hidden" name="userName"
                           value="<security:authentication property="principal.username"/>">
                    <security:authentication property="principal.username"/>
                    <security:authorize access="hasRole('ADMIN')">管理员</security:authorize>
                    <security:authorize access="hasRole('USER')">业务员</security:authorize>
                    <security:authorize access="hasRole('MANAGER')">经理</security:authorize>
                </p>
                <a href="#"><i class="fa fa-circle text-success"></i> 在线</a>
            </div>
        </div>

        <!-- sidebar menu: : style can be found in sidebar.less -->
        <ul class="sidebar-menu">
            <li class="header">菜单</li>
            <li id="admin-index"><a
                    href="${pageContext.request.contextPath}/pages/main.jsp"><i
                    class="fa fa-dashboard"></i> <span>首页</span></a></li>

            <security:authorize access="hasRole('ADMIN')">
            <li class="treeview">
                <a href="#"> <i class="fa fa-cogs"></i>
                 <span>员工管理</span> <span class="pull-right-container">
                    <i class="fa fa-angle-left pull-right"></i>
				</span>
                </a>
                <ul class="treeview-menu">

                    <li id="system-setting">
                        <security:authorize access="hasRole('ADMIN')">
                        <a href="${pageContext.request.contextPath}/user/findAll.do">
                            <i class="fa fa-circle-o"></i> 员工管理</a></li>
                    </security:authorize>

                    <li id="system-setting">
                        <security:authorize access="hasAnyRole('ADMIN')">
                        <a href="${pageContext.request.contextPath}/role/findAll.do">
                            <i class="fa fa-circle-o"></i> 角色管理</a></li>
                    </security:authorize>

                    <li id="system-setting">
                        <security:authorize access="hasRole('ADMIN')">
                        <a href="${pageContext.request.contextPath}/permission/findAll.do">
                            <i class="fa fa-circle-o"></i> 资源权限管理</a></li>
                    </security:authorize>
                </ul>
            </li>
            </security:authorize>

            <security:authorize access="hasRole('ADMIN')">
            <li class="treeview">
                <a href="#"> <i class="fa fa-cube"></i>
                    <span>系统操作日志数据</span> <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
				</span>
                </a>
                <ul class="treeview-menu">
                    <li id="system-setting">
                        <security:authorize access="hasRole('ADMIN')">
                        <a href="${pageContext.request.contextPath}/sysLog/findAll.do">
                            <i class="fa fa-circle-o"></i> 访问日志</a></li>
                    </security:authorize>
                </ul>
            </li>
            </security:authorize>

            <li class="treeview">
                <a href="#"> <i class="fa fa-edit"></i>
                    <span>客户管理</span> <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i></span></a>
                <ul class="treeview-menu">

                    <li id="system-setting">
                        <security:authorize access="hasAnyRole('USER','ADMIN','MANAGER')">
                        <a href="${pageContext.request.contextPath}/customer/findAll.do">
                            <i class="fa fa-circle-o"></i> 客户列表</a></li>
                    </security:authorize>

                    <li id="system-setting">
                        <security:authorize access="hasAnyRole('USER','ADMIN','MANAGER')">
                        <a href="${pageContext.request.contextPath}/customer/saveBefore.do">
                            <i class="fa fa-circle-o"></i> 新增客户</a></li>
                    </security:authorize>

                </ul>
            </li>


            <li class="treeview">
                <a href="#"> <i class="fa fa-edit"></i>
                    <span>联系人管理</span> <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i></span></a>
                <ul class="treeview-menu">

                    <li id="system-setting">
                        <security:authorize access="hasAnyRole('USER','ADMIN','MANAGER')">
                        <a href="${pageContext.request.contextPath}/linkman/findAll.do">
                            <i class="fa fa-circle-o"></i> 联系人列表</a></li>
                    </security:authorize>

                    <li id="system-setting">
                        <security:authorize access="hasAnyRole('USER','ADMIN','MANAGER')">
                        <a href="${pageContext.request.contextPath}/linkman/saveBefore.do">
                            <i class="fa fa-circle-o"></i> 新增联系人</a></li>
                    </security:authorize>

                </ul>
            </li>

            <li class="treeview">
                <a href="#"> <i class="fa fa-book"></i>
                    <span>拜访活动管理</span> <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i></span></a>
                <ul class="treeview-menu">

                    <li id="system-setting">
                        <security:authorize access="hasAnyRole('USER','ADMIN','MANAGER')">
                        <a href="${pageContext.request.contextPath}/visit/findAll.do">
                            <i class="fa fa-circle-o"></i> 拜访记录列表</a></li>
                    </security:authorize>

                    <li id="system-setting">
                        <security:authorize access="hasAnyRole('USER','ADMIN','MANAGER')">
                        <a href="${pageContext.request.contextPath}/visit/saveBefore.do">
                            <i class="fa fa-circle-o"></i> 新增拜访记录</a></li>
                    </security:authorize>

                </ul>
            </li>

        </ul>
    </section>
    <!-- /.sidebar -->
</aside>